<template>
    <span class="num-txt">
        {{ numStr }}
    </span>
</template>

<script lang="ts" setup>
import { computed } from "vue";
import { formatBigNumber, numberWithCommas } from "@/comm/format";

const numStr = computed(() => {
    let val: any = Math.abs(props.num);
    val = numberWithCommas(val);
    if (val.indexOf(".") == -1) {
        return val + ".00";
    }
    let ary = val.split(".");
    return ary[0] + "." + (ary[1] + "00").substring(0, 2);
});

const props = defineProps({
    num: {
        default: 0
    },
    fix: {
        default: 2
    }
});
</script>

<style lang="less" scoped>
// @import url("./index.less");
</style>
